home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-12-16 | 6.1 KB | 258 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWStdDef.h
- // Release Version: $ ODF 3 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWSTDDEF_H
- #define FWSTDDEF_H
-
- #ifndef FWENVDEF_H
- #include "FWEnvDef.h"
- #endif
-
- #ifndef FWERRORS_H
- #include "FWErrors.h"
- #endif
-
- #if defined(FW_BUILD_MAC) & !defined(__TYPES__)
- #include <Types.h>
- #endif
-
- #if defined(FW_BUILD_MAC) & !defined(__FRAGRSRC__)
- #include "FragRsrc.h"
- #endif
-
- #if defined(FW_BUILD_MAC) & !defined(__LOWMEM__)
- #include <LowMem.h>
- #endif
-
- #if defined FW_BUILD_MAC && !defined __FILES__
- #include <Files.h>
- #endif
-
- #if defined FW_BUILD_MAC && !defined __QUICKDRAW__
- #include <Quickdraw.h>
- #endif
-
- #if defined FW_BUILD_WIN
- #define STRICT
- #define WIN32_LEAN_AND_MEAN
- #define WIN32_EXTRA_LEAN
- #include <windows.h>
-
- // [jkp] 961009
- // This file defines SOMLINK and SOMDLINK. We should not define our
- // own flavors for these because OpenDoc for windows has certain
- // expectations to which we must conform.
- #include <somltype.h>
- #endif
-
- FW_EXTERN_C_BEGIN
-
- /*========================================================================================
- / Build system macro definitions
- /========================================================================================*/
-
- /*----------------------------------------------------------------------------------------
- /
- / The macro SL_API is used to define more effecient calling convention for the Windows
- / version of the ODF shared library (SL). It should be used like this:
- /
- / void* SL_APL FW_OhWellWhateverNevermind(long l, short s);
- /
- /----------------------------------------------------------------------------------------*/
-
- #ifdef FW_BUILD_MAC
- #define SL_API
- #endif
-
- #ifdef FW_BUILD_WIN
- #define SL_API __stdcall
- #endif
-
- #ifndef SOMCHKEXCEPT
- #define SOMCHKEXCEPT You_forgot_to_include_FWODExce_has_the_first_header_in your__cpp
- #endif
-
- /*========================================================================================
- // Define OpenDoc version number so we can use appropriate interface
- /========================================================================================*/
-
- #ifndef FW_OPENDOC_VERSION
-
- #define FW_OPENDOC_DR1 1
- #define FW_OPENDOC_DR2 2
- #define FW_OPENDOC_DR3 3
- #define FW_OPENDOC_DR4 4
- #define FW_OPENDOC_100 FW_OPENDOC_DR4
- #define FW_OPENDOC_101 5
- #define FW_OPENDOC_110 6
-
- #ifdef FW_BUILD_MAC
- #define FW_OPENDOC_VERSION FW_OPENDOC_110
- #endif
-
- #ifdef FW_BUILD_WIN
- #define FW_OPENDOC_VERSION FW_OPENDOC_DR4
- #endif
-
- #endif
-
- /*========================================================================================
- / Type definitions
- /========================================================================================*/
-
- #ifndef FW_COMPILER_SUPPORTS_BOOL
- //typedef unsigned char bool;
- #define false 0
- #define true 1
- #endif
-
- typedef unsigned char FW_Boolean;
-
- // typedef used as return value for functions that need to indicate whether
- // a dispatched event should be propogated further down a handler chain
-
- typedef FW_Boolean FW_Handled;
- #define FW_kHandled TRUE
- #define FW_kNotHandled FALSE
-
- // FW_Message is defined in "FWNotDef.h" which may be included by resource files
- // typedef long FW_Message;
-
- // ----- Macintosh -----
- #ifdef FW_BUILD_MAC
-
- typedef short FW_ResourceID;
-
- typedef char** FW_PlatformHandle;
-
- typedef unsigned long FW_ResourceType;
-
- struct FW_SCodeFragRefFile
- {
- CFragResFileRef fFragRef; // Reference to resource map
- short fRefNum; // RefNum of resource file
- long fNesting; // Nesting level (>0 means in use)
- };
-
- typedef FW_SCodeFragRefFile* FW_Instance;
-
- typedef double_t FW_Double;
-
- typedef Rect FW_PlatformRect;
- typedef Point FW_PlatformPoint;
- typedef short FW_PlatformCoordinate;
-
- #endif
-
-
- // ----- Windows -----
- #ifdef FW_BUILD_WIN
-
- typedef unsigned short FW_ResourceID;
-
- typedef HANDLE FW_PlatformHandle;
-
- typedef unsigned short FW_ResourceType;
-
- typedef HINSTANCE FW_Instance;
-
- typedef double FW_Double;
-
- typedef RECT FW_PlatformRect;
- typedef POINT FW_PlatformPoint;
-
- #ifdef FW_BUILD_WIN32
- typedef long FW_PlatformCoordinate;
- #endif
- #ifdef FW_BUILD_WIN16
- typedef int FW_PlatformCoordinate;
- #endif
-
- #endif
-
- /*========================================================================================
- / Mac A5 Globals
- /========================================================================================*/
-
- #ifdef FW_BUILD_MAC
-
- #define FW_QDGlobals (*(QDGlobals*)( *(char**)LMGetCurrentA5() \
- - sizeof(QDGlobals) + sizeof(GrafPtr)))
- #endif
-
- /*========================================================================================
- / Constants
- /========================================================================================*/
-
- #ifndef NULL
- #define NULL 0
- #endif
-
- #ifndef FALSE
- #define FALSE 0
- #endif
-
- #ifndef TRUE
- #define TRUE 1
- #endif
-
- /*========================================================================================
- / Macros
- /========================================================================================*/
-
- #define FW_UNUSED(x) ((void) &x)
-
- FW_EXTERN_C_END
-
- //========================================================================================
- // Minimum and maximum functions
- //========================================================================================
-
- #if 0
-
- #define FW_PRIV_DEFINE_MIN_MAX(t) \
- inline t FW_Minimum(t a, t b) \
- { return a < b ? a : b; } \
- inline t FW_Maximum(t a, t b) \
- { return a > b ? a : b; }
-
- #define FW_PRIV_DEFINE_ABS(t) \
- inline t FW_Absolute(t a) \
- { return a < 0 ? -a : a; }
-
- FW_PRIV_DEFINE_MIN_MAX(short)
- FW_PRIV_DEFINE_ABS(short)
-
- FW_PRIV_DEFINE_MIN_MAX(unsigned short)
-
- FW_PRIV_DEFINE_MIN_MAX(int)
- FW_PRIV_DEFINE_ABS(int)
-
- FW_PRIV_DEFINE_MIN_MAX(unsigned int)
-
- FW_PRIV_DEFINE_MIN_MAX(long)
- FW_PRIV_DEFINE_ABS(long)
-
- FW_PRIV_DEFINE_MIN_MAX(unsigned long)
-
- #else
-
- template <class t>
- inline t FW_Minimum(t a, t b) { return a < b ? a : b; }
-
- template <class t>
- inline t FW_Maximum(t a, t b) { return a > b ? a : b; }
-
- template <class t>
- inline t FW_Absolute(t a) { return a < 0 ? -a : a; }
-
- #endif
-
- #endif
-